package operation;

import book.Book;
import book.BookList;

/**
 * @program: 11.22
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-22 21:19
 **/
public class AddOperation implements IOperation {
    public void work(BookList bookList){
        System.out.println("新增图书");
        System.out.println("请输入图书的书名：");
        String name=scanner.nextLine();
        System.out.println("请输入图书的作者：");
        String author=scanner.nextLine();
        System.out.println("请输入图书的类型：");
        String type=scanner.nextLine();
        System.out.println("请输入图书的价格：");
        int price=scanner.nextInt();
        Book book=new Book(name,author,price,type);
        int size=bookList.getUsedsize();
        bookList.setBook(book,size);
        bookList.setUsedsize(size+1);
        System.out.println("增加成功");
    }

}
